//
//  FLMChatBaseCell.h
//  FLMSuperS
//
//  Created by chenshan on 2016/10/9.
//  Copyright © 2016年 FaLaoMiaoNetworkTechnologyCo. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "TTTAttributedLabel.h"

#define FLMCellEditingEdgeLength 20
#define FLMCellPadding 10
#define FLMAvatarEdgeLength 40
#define FLMIndicatorWidth 20
#define FLMContentUpDownPadding 5
#define FLMContentLeftRightPaddingMax 25
#define FLMBubbleArrowWidth 10
#define FLMContentLeftRightPaddingMin 15
#define FLMErrorEdgeLength 20

#define FLMFontBody [UIFont preferredFontForTextStyle:UIFontTextStyleBody]            //正常大小
#define FLMFontContent [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] //文本大小
#define FLMFontMin [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]         //迷你

#define FLMColorMain FLMRGBColor(90,136, 231)                   //主调色
#define FLMColorBackgroud FLMRGBColor(245,245,245)             //背景色
#define FLMColorSeparator FLMRGBColor(221,221,221)             //分割线色

#define FLMColorBody FLMRGBColor(51,51, 51)                     //正常文本色
#define FLMColorContent FLMRGBColor(102,102,102)               //内容文本色
#define FLMColorSecondary FLMRGBColor(153,153,153)             //次要辅助色
#define FLMColorHighlight FLMRGBColor(60,93, 161)               //按钮高亮色

#define FLMRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]// RGB色

#define FLMScreenW [UIScreen mainScreen].bounds.size.width
#define FLMScreenH [UIScreen mainScreen].bounds.size.height

typedef NS_ENUM(NSInteger, FLMChatCellUserType) {
    FLMChatCellUserTypeMyself,
    FLMChatCellUserTypeOther,
};

typedef NS_ENUM(NSInteger, FLMChatCellStatus) {
    FLMChatCellStatusNormal,
    FLMChatCellStatusSending,
    FLMChatCellStatusError,
};


@interface FLMChatBaseCell : UITableViewCell<TTTAttributedLabelDelegate> {
    CGRect avatareFrame, nicknameFrame, sendingFrame, errorFrame, editingFrame;
}

@property (strong, nonatomic) UIActivityIndicatorView *sendingIndicator;
@property (strong, nonatomic) UIImageView *errorImgView;

@property (strong, nonatomic) UIImage *bubbleMyself;
@property (strong, nonatomic) UIImage *bubbleOther;

@property (strong, nonatomic) NSIndexPath *indexPath;

@property (nonatomic) BOOL isShowNickname;

@property (nonatomic) BOOL isMultEditingSelected;

@property (nonatomic) FLMChatCellUserType userType;

@property (nonatomic) FLMChatCellStatus status;

//views proteries
@property (strong, nonatomic) UIImageView *avatarImgView;
@property (strong, nonatomic) UIImageView *editingView;
@property (strong, nonatomic) TTTAttributedLabel *nicknameLabel;

- (void)commitInit;

- (void)buildMyselfAvatarFrame;
- (CGSize)buildMyselfNicknameFrame;

- (void)buildOtherAvatarFrame;
- (CGSize)buildOtherNicknameFrame;

- (CGSize)getNicknameSize;

//subclass need to override those methods
- (void)UIPrepareForSendingDataStatus;
- (void)UIPrepareForCreateStatus;
- (void)UIPrepareForNormalStatus;
- (void)UIPrepareForErrorStatus;
- (CGFloat)getHeight;


@end
